<?php
	include "getRuleNewsAdd.php";
	
	$newsHeader = $_POST['newsHeader'];
	$newsText = $_POST['newsText'];
	$newsDateFrom = $_POST['newsDateFrom'];
	$newsDateTo = $_POST['newsDateTo'];
	$newsIsTemp = $_POST['newsIsTemp'];
	
	if ($newsIsTemp == 'false'){
		$newsDateFrom = date('Y.m.d');
		$newsDateTo = 'NULL';
	}
	
	if ($ruleNewsAdd){
		$sql = "
			INSERT INTO news (id, isLock, header, text, dateFrom, dateTo, userAdd, userEdit, dateAdd, dateEdit)
			VALUES
			(NULL, 0, '".$newsHeader."', '".$newsText."', '".$newsDateFrom."', '".$newsDateTo."', '".$userId."', NULL, '".date('Y.m.d H:i:s')."', NULL)
		";
		mysql_query($sql);
	}
?>
